<?php
/**
 * Created by PhpStorm.
 * User: zyark
 * Date: 2017/6/9
 * Time: 12:52
 */

namespace Admin\Logic;


use Think\AjaxPage;

class MoneyLogLogic
{
    public function getMoneyLogList($map,$bind,$order){
        $count = D('MoneyLog')->where($map)->bind($bind)->count();
        $Page  = new AjaxPage($count,10);
        $limit = $Page->firstRow.','.$Page->listRows;//每页的数据数和内容$limit
        $moneyLogList = D('MoneyLog')
            ->join('LEFT JOIN tp_users u ON u.user_id=tp_money_log.user_id')
            ->where($map)->bind($bind)->order($order)->limit($limit)
            ->field('u.nickname as username,tp_money_log.*')
            ->select();
        foreach ($moneyLogList as $key=>$value){
            $moneyLogList[$key]['create_time'] = date("Y年m月d日", $moneyLogList[$key]['create_time']);
        }
        $data['list'] = $moneyLogList;
        $data['page'] = $Page->show();
        $data['count'] = $count;
        return $data;
    }
}